package com.nezha.lib_log.logger

import android.util.Log
import com.nezha.lib_log.LoggerLevel

class EmailLogger:ILogger {
    private var isDebug=true
    private var TAG=""
    private var level=LoggerLevel.Debug
    private var loggerFormat="%s=====>%s"
    private var url=""
    override fun d(tag: String, log: String) {
        if(isDebug&&level.value>=LoggerLevel.Debug.value){
            val log=String.format(loggerFormat,tag,log)
            println("发送邮件：${log}")
        }
    }

    override fun v(tag: String, log: String) {
        if(isDebug&&level.value>=LoggerLevel.Verbose.value){
            val log=String.format(loggerFormat,tag,log)
            println("发送邮件：${log}")
        }
    }

    override fun i(tag: String, log: String) {
        if(isDebug&&level.value>=LoggerLevel.Info.value){
            val log=String.format(loggerFormat,tag,log)
            println("发送邮件：${log}")
        }
    }

    override fun w(tag: String, log: String) {
        if(isDebug&&level.value>=LoggerLevel.Warn.value){
            val log=String.format(loggerFormat,tag,log)
            println("发送邮件：${log}")
        }
    }

    override fun e(tag: String, log: String) {
        if(isDebug&&level.value>=LoggerLevel.Error.value){
            val log=String.format(loggerFormat,tag,log)
            println("发送邮件：${log}")
        }
    }

    override fun setDebug(isDebug: Boolean) {
        this.isDebug=isDebug
    }

    override fun setLogTAG(TAG: String) {
        this.TAG=TAG
    }

    override fun setLoggerLevel(level: LoggerLevel) {
        this.level=level
    }

    override fun setSaveUrl(url: String) {
        this.url=url
    }
}